package com.wanbangee.marksystem.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.wanbangee.marksystem.entities.MStudentAnswerSheet;
import com.wanbangee.marksystem.entities.SScore;

@Mapper
public interface SScoreDao {
	
	

	/**
	 * 查询客观题选项分布
	 * @param examId
	 * @param subId
	 * @param claId
	 * @param topicNo
	 * @return
	 */
	public List<Map> selectObjectOptionDistribution(@Param("examId")Integer examId,@Param("subId")Integer subId,@Param("claId")Integer claId,@Param("topicNo")String topicNo);
	
	/**
	 * 查询个人选项列表
	 * @param examId
	 * @param calId
	 * @param subId
	 * @param topicNo
	 * @param option
	 * @param stuNmAndStuNo
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public List<Map> selectObjectiveStudentOption(@Param("examId")Integer examId,@Param("claId")Integer claId,@Param("subId")Integer subId,
			@Param("topicNo")String topicNo,@Param("option")String option,@Param("stuNmAndStuNo")String stuNmAndStuNo,@Param("pageNum")Integer pageNum,@Param("pageSize")Integer pageSize);
	
	/**
	 * 单评下的主观题得分表
	 * @param examId
	 * @param subId
	 * @param topicNo
	 * @param claId
	 * @param minScore
	 * @param maxScore
	 * @param stuNmOrStuNo
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public List<Map> selectSubjectiveScoreSingleComment(@Param("examId")Integer examId,@Param("subId")Integer subId,@Param("topicNo")String topicNo,@Param("claId")Integer claId,
			@Param("minScore")Double minScore,@Param("maxScore")Double maxScore,@Param("stuNmOrStuNo")String stuNmOrStuNo,@Param("pageNum")Integer pageNum,@Param("pageSize")Integer pageSize);
	
	/**
	 * 多评下的主观题得分表
	 * @param examId
	 * @param subId
	 * @param topicNo
	 * @param claId
	 * @param minScore
	 * @param maxScore
	 * @param stuNmOrStuNo
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public List<Map> selectSubjectiveScoreMoreComment(@Param("examId")Integer examId,@Param("subId")Integer subId,@Param("topicNo")String topicNo,@Param("claId")Integer claId,
			@Param("minScore")Double minScore,@Param("maxScore")Double maxScore,@Param("stuNmOrStuNo")String stuNmOrStuNo,@Param("pageNum")Integer pageNum,@Param("pageSize")Integer pageSize);
	
	/**
	 * 主观题班级得分分布
	 * @param examId
	 * @param subId
	 * @param claId
	 * @param topicNo
	 * @param scoreList
	 * @return
	 */
	public List<Map> selectSubjectiveDistribution(@Param("examId")Integer examId,@Param("subId")Integer subId,@Param("claId")Integer claId,@Param("topicNo")String topicNo,@Param("list")List<Double> scoreList);

	/**
	 * 根据考试id和考试科目ID查询这科目的高分作文的学生信息
	 * @param examId
	 * @param examSubId
	 * @return
	 */
	List<Map> selectSscoreByExamIdAmdExamSubId(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId);
	
	//=================质量监控============================
		/**
		 * 通过 scoreId 查询阅卷表信息，用于获取题目图片
		 * @param scoreId
		 * @return
		 */
		 public SScore selectSScoreTopicUrlByScoreId(Integer scoreId,Integer examId,Integer examSubId);
		 
		 
		 //================重评任务=========================
		 /**
		  * 通过 scoreId 更新阅卷表，更新重评状态
		  * @param examId
		  * @param examSubId
		  * @param scoreId
		  * @param repeatCause
		  * @return
		  */
		 public Integer updateSScoreBySScoreId(Integer examId,Integer examSubId,Integer scoreId,String repeatCause);
		 
		 /**
		  * 修改重评状态，如果两个老师已经评分
		  * @param examId
		  * @param examSubId
		  * @param markerId
		  * @param topicNo
		  * @return
		  */
		 public Integer updateSScoreByExamIdExamSubIdMarkerIdTopicNo(Integer examId,Integer examSubId,Integer markerId,Integer topicNo,Integer scoreType);
		 
		 
		 /**
		  * 获取重评题目的信息
		  */
		 public List<SScore> selectSScoreByExamIdExamSubIdMarkerIdTopicNoOnRepeat(Integer examId,Integer examSubId,Integer markerId,Integer topicNo,Integer teaNo,Integer teaId); 
		 
		 /**
		  * 查询是多评还是单评
		  * @param examId
		  * @param examSubId
		  * @param markerId
		  * @param topicNo
		  * @return
		  */
		 public Integer selectSScoreByExamIdExamSubIdMarkerIdTopicNo(Integer examId,Integer examSubId,Integer markerId,Integer topicNo);
		 
		 /**
		  * 获取老师姓名
		  * <select id="selectUTeacherTeaNmByteaId" resultType="String">
		  */
		 public String selectUTeacherTeaNmByteaId(Integer teaId1,Integer teaId2);
		 
		 /**
		  * 查询阅卷人1还是阅卷人2
		  * 
		  */
		 public Integer selectSScoreByExamIdExamSubIdMarkerIdTopicNoOnTea12(Integer examId,Integer examSubId,Integer markerId,Integer topicNo,Integer teaId);


		//================进度管理=========================
		 /**
		  * 更新阅卷任务-分解阅卷任务
		  * @param examId
		  * @param examSubId
		  * @param topicNo
		  * @param markerId
		  * @return
		  */
		 public Integer updateSScoreByExamIdAndExamSubIdAndTopicNoAndMarkerId(Integer examId, Integer examSubId, Integer oldMarkerId,
					Integer teaId,Integer teaId1,Integer teaId2, Integer topicNo, Integer newMarkerId,Integer allocation_num,Integer score_type);


			 //========================================================================================================================
		 
			/**
			 * 插入一条记录
			 * @param scoreT 对象
			 * @param examId
			 * @param examSubId
			 * @return
			 */
			public Integer insertScore(@Param("scoreT")SScore scoreT,@Param("examId")Integer examId,@Param("examSubId")Integer examSubId);
		 
			/**
			 * 删除记录一条记录
			 * @param examId
			 * @param examSubId
			 * @param scoreId
			 * @return
			 */
			public Integer delectScoreByExamIdExamSubIdScoreId(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId,@Param("scoreId")Integer scoreId);
			
			/**
			 * 查询出特殊卷信息，用于插入答题记录表
			 * @param examId
			 * @param examSubId
			 * @param markerId
			 * @param scoreId
			 * @return
			 */
			public MStudentAnswerSheet selectAnswerSheetRecordInfo(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId,@Param("markerId")Integer markerId,@Param("scoreId")Integer scoreId);
			
			/**
			 * 查询仲裁题目的信息（用于仲裁打分界面的显示）
			 * 根据下面4个参数确定，某个老师打某道题的信息（同一个题目，有多个学生作答）
			 * @param examId
			 * @param examSubId
			 * @param teaId
			 * @param topicNo 
			 * @return
			 */
			public List<SScore> selectArbitrationSScoreInfoByExamIdExamSubIdTeaId(Integer examId, Integer examSubId,
					Integer teaId, String topicNo);
			
			/**
			 * 查询阅卷打分题目的信息（用于阅卷打分界面的显示）
			 * 根据下面4个参数确定，某个老师打某道题的信息（同一个题目，有多个学生作答）
			 * @param examId
			 * @param examSubId
			 * @param teaId
			 * @param topicNo 
			 * @return
			 */
			public List<SScore> selectSScoreInfoByExamIdExamSubIdTeaId(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId,@Param("teaId")Integer teaId,@Param("topicNo")String topicNo);
			
		//@Param("examId")Integer examId,,@Param("examSubId")Integer examSubId,@Param("teaId")Integer teaId,@Param("topicNo")String topicNo	
			
			
			
			/**
			 * 查询老师是几号阅卷人，返回分数字段名
			 * eg：
			 * 一号阅卷人  ---> score1
			 * 二号阅卷人  ---> score2
			 * 
			 * @param examId
			 * @param examSubId
			 * @param teaId
			 * @param scoreId
			 * @return
			 */
			public String selectScoreNameByExamIdExamSubIdTeaIdScoreId(@Param("examId")Integer examId,@Param("examSubId")Integer examSubId,@Param("teaId")Integer teaId,@Param("scoreId")Integer scoreId);

			
}
